const path = require("path")

const HtmlWebPlugin = require('html-webpack-plugin')

const htmlPlugin = new HtmlWebPlugin({
    template: path.join(__dirname, "./src/index.html"),
    filename: "index.html"
})
module.exports = {
    mode: "development",
    plugins: [
        htmlPlugin
    ],
    module: { //所有第三方 模块的配置文件
        rules: [
            {test: /\.js|jsx$/, use: 'babel-loader', exclude: /node_modules/}, //千万别忘记排除 node_modules
            {test: /\.css$/, use:['style-loader','css-loader']},
            {test: /\.ttf|woff|eot|svg$/, use:"url-loader"},
            {test: /\.scss$/, use:['style-loader','css-loader?modules&localIdentName=[path][name]-[local]-[hash:5]','sass-loader']},
        ]
    },
    resolve: {
        extensions: [".js",".jsx",".json"],
        alias:{
            "@": path.join(__dirname,'./src')
        }
    },
    devServer: {
        disableHostCheck: true,
    }


}